 nul=[] execVM "Include\KRON_Strings.sqf";   
ServerInitEnds=false;
isDebug=true;

debug={
	if(isDebug)then{
		_message=_this;
		player globalChat _message;
	};
};

GameEnd=false;

//HumanGroup=[h1,h2,h3,h4,h5,h6];
//AgentGroup=[a1,a2,a3];

//for "_i" from 0 to count(HumanGroup) do
/* {
	if(!isPlayer(_x))then{
		HumanGroup=HumanGroup-[_x];
	};
}foreach HumanGroup; 

//for "_i" from 0 to count(AgentGroup) do
{
	if(!isPlayer(_x))then{
		AgentGroup=AgentGroup-[_x];
	};
}foreach AgentGroup;
*/

//str AgentGroup call debug;
//str HumanGroup call debug;

cabine=nil;
TankAddAmmo=nil;
TankAddWeapon=nil;

CabsList=[];


HumanObjectiveCompleted=false;

CivilDetectionDuration = 10;
objNumbers=3;

Objective=objNull;
selectedCab=objNull;

isRinging=false;
isPhoneAnswered=false;

WeaponList=
[
	["AK47 M","AK_47_M","30Rnd_762x39_AK47",10],
	["AK47 S","AK_47_S","30Rnd_762x39_AK47",10],
	["AK47 GL","AK_74_GL","30Rnd_762x39_AK47",10],
	["AKS74","AKS_74_U","30Rnd_545x39_AKSD",10],
	["AKS 74 UNKobra","30Rnd_545x39_AKSD",10],
	["RPK","RPK_74","75Rnd_545x39_RPK",10],
	["PK","PK","100Rnd_762x54_PK",10],
	["Hunting Rifle","huntingrifle","5x_22_LR_17_HMR",10],
	["SVD","SVD","10Rnd_762x54_SVD",10],
	["RPG7V","RPG7V","PG7V",10],
	["Strela","Strela","Strela",10],
	["Makarov","Makarov","8Rnd_9x18_Makarov",10]
];

AmmoList=["PG7V","PG7VL","PG7VR","OG7","Strela","PipeBomb","TimeBomb","HandGrenade","Binocular"];

/////////////////////////////////////////////////////////////////////////////////////////////////////

[] execVM "ServerWatchTankWeapons.sqf";

if (isServer)then{

    //cabine = "Land_KBud" createVehicle getPos cab_1;
   // player setPos getPos cab_1;
   [] execVM "testCab.sqf";
	ObjectiveNumber=ceil(random objNumbers);
	publicVariable "ObjectiveNumber";
	
	[] execVM "ServerWatchObjectives.sqf";
	
	
 
	NearestBusStop={


		private["_location","_radius","_list","_obj"];
		_location = _this select 0;
		_radius = _this select 1;
		_obj=objNull;
		_list = nearestObjects [_location,[],_radius];
		
		
		
		{ // foreach objects
		
			//player globalChat ("TEST into "+str _x);
			
			if ( [str _x,"busstop"] call KRON_StrInStr ) then
			{
				//player globalChat ("busstop !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "+str _x+" => "+str time);
				_obj=_x;
				
			};

		}forEach _list;
			
			
		_obj
		
	};

};


if (!isDedicated or !isServer)then{

	sleep 1;
		
    // init local side
    [] execVM "ServerRingThePhone.sqf";	
	
	
    switch (side player) do {

        // Agent
        case west : {
            [player] execVM "initAgent.sqf";
            //player globalChat format["ahaha 2 %1",HumanGroup];
         };

         // humans
        case resistance : {
			
            if(player != TankPlayer) then {
                 [player] execVM "initHuman.sqf";
            }else{
				player globalchat "Im tank";
                 [player] execVM "initTank.sqf";
            };
			
			
			
        };
    };
};


